New Functions in Week 2

select

{dplyr}

Select columns from a tibble/data frame

pie

{graphics}

Creates a basic pie chart

summary

{base}

Obtain summary statistics or detailed regression output

max

{base}

Get maximum of a vector

ggplot

{GGPLOT2}

Create a ggplot graph

sum

{base}

Get sum of numeric values or a vector

range

{base}

Return range of values

hist

{graphics}

Plot a simple histogram

cut

{base}

Convert Numeric to Factor

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

mutate

{dplyr}

Modify/create a column in a data frame

seq

{base}

Create a sequence

desc

{dplyr}

Arrange in descending order

levels

{base}

Get levels of a factor

min

{base}

Get minimum of a vector

ordered

{dplyr}

Create an ordered factor

median

{stats}

Get median of a vector

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

slice

{dplyr}

Subset rows using their positions

rm

{base}

Remove objects

read_excel

{readxl}

Read an Excel file

recode

{dplyr}

Recode a variable

is.na

{base}

Check if a value is NA/elements of vector are NA

factor

{base}

Create a factor

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

filter

{dplyr}

Filter out rows of a data frame according to logical vector

lprop

{questionr}

Display row percentages of a two-way frequency table

geom_histogram

{GGPLOT2}

Generates a histogram

labs

{GGPLOT2}

Customise labels in GGPLOT2

boxplot

{graphics}

Plot a simple box plot

var

{stats}

Calculate variance

ungroup

{dplyr}

Resolve grouping created with “group_by”

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

install.packages

{base}

Install R package

freq

{questionr}

Generate frequency tables

geom_bar

{GGPLOT2}

Generates a bar chart

The end!